//是否是回文字符串 (只考虑数字字符和字母，忽略大小写)
#include <stdio.h>
#include <string.h>

//是否是字母或数字字符
static int isValidChar(char c)
{

    return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
}
//转小写
static char toLowerCase(char c)
{
    if (c >= 65 && c <= 90)
    {
        return (char)(c + 32);
    }
    return c;
}

//是否是回文字符串
static int isPalindrome(char *s)
{
    int len = strlen(s);
    int start = 0;
    int end = len - 1;
    char c;
    while (start < end)
    {
        c = s[start];
        if (!isValidChar(c))
        {
            start++;
            continue;
        }
        c = s[end];
        if (!isValidChar(c))
        {
            end--;
            continue;
        }

        if (toLowerCase(s[start]) != toLowerCase(s[end]))
        {
            return 0;
        }
        start++;
        end--;
    }

    return 1;
}

int main_14()
{
    int r = isPalindrome("A man, a plan, a canal: Panama");
    printf("%d\n", r);
    return 0;
}